package com.qf.entity;


import com.qf.utils.CheckPhone;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.ObjectUtils;
@ApiModel("黑名单对象")
public class TBlackList implements CheckNull {
  @ApiModelProperty("主键，添加不用传递")
  private Long id;
  @ApiModelProperty("手机号")
  private String mobile;
  @ApiModelProperty("创建者类型")
  private Long owntype;
  @ApiModelProperty("创建者id")
  private Long creater;
  @ApiModelProperty("创建者信息")
  private TAdminUser tAdminUser;
  @Override
  public boolean isNull(CheckType type) {
    switch (type){
      case ADD:
        return CheckPhone.isPhone(mobile);
      case UPDATE:
        return ObjectUtils.isEmpty(id)||!CheckPhone.isPhone(mobile);
      case DELETE:
        return false;
    }
    //如果是更新 返回XXX
    return CheckNull.super.isNull(type);

  }

  @Override
  public String toString() {
    return "TBlackList{" +
            "id=" + id +
            ", mobile='" + mobile + '\'' +
            ", owntype=" + owntype +
            ", creater=" + creater +
            '}';
  }

  public TAdminUser gettAdminUser() {
    return tAdminUser;
  }

  public void settAdminUser(TAdminUser tAdminUser) {
    this.tAdminUser = tAdminUser;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }


  public String getMobile() {
    return mobile;
  }

  public void setMobile(String mobile) {
    this.mobile = mobile;
  }


  public Long getOwntype() {
    return owntype;
  }

  public void setOwntype(Long owntype) {
    this.owntype = owntype;
  }


  public Long getCreater() {
    return creater;
  }

  public void setCreater(Long creater) {
    this.creater = creater;
  }

}
